package com.hung.triple.consumer;

import com.alibaba.nacos.api.naming.listener.EventListener;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

/**
 * 封装 consumer 的基本信息
 *
 * @author Hung
 * @since 2022/9/18
 */
@Data
@Builder
@AllArgsConstructor

public class ConsumerBeanInfo {

    private String groupName;
    private String version;
    private String serviceName;

    /**
     * 超时时间
     */
    private Long timeoutMS;

    /**
     * 是否异步
     */
    private boolean async;

    /**
     * Nacos注册中心 监听器
     * 如果不选用Nacos的话这里为null
     */
    private EventListener eventListener;

    public ConsumerBeanInfo(String groupName, String version, String serviceName) {
        this.groupName = groupName;
        this.version = version;
        this.serviceName = serviceName;
    }


    public ConsumerBeanInfo(String groupName, String version, String serviceName, Long timeoutMS, boolean async) {
        this.groupName = groupName;
        this.version = version;
        this.serviceName = serviceName;
        this.timeoutMS = timeoutMS;
        this.async = async;
    }
}
